package com.im.controller;

import com.im.entity.vo.ImPrivateMessageVO;
import com.im.service.IImPrivateMessageService;
import com.im.utils.page.ConditionDTO;
import com.im.utils.page.PageResult;
import com.im.web.response.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author im
 * @since 2025-01-30
 */
@Tag(name = "私聊消息模块")
@RestController
@RequestMapping("/link-IM/im-private-message")
public class ImPrivateMessageController {
    @Autowired
    private IImPrivateMessageService iImPrivateMessageService;
    //消息拉取
    @Operation(summary = "消息拉取-根据会话维度拉取全部消息")
    @PostMapping("/pull/all")
    public Result<Object> pull(@RequestBody Long sessionId){
        return Result.success(iImPrivateMessageService.pull(sessionId));
    }
    //分页拉取消息
    @Operation(summary = "分页拉取消息-根据会话维度拉取全部消息")
    @PostMapping("/pull/page")
    public Result<PageResult<ImPrivateMessageVO>> pullPage(ConditionDTO conditionDTO){
        return Result.success(iImPrivateMessageService.pullPage(conditionDTO));
    }

}

